/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package teamBlitz;

import edu.wpi.first.wpilibj.DigitalModule;
import edu.wpi.first.wpilibj.I2C;

/**
 *
 * @author tlemmons
 */
public class I2CSync extends I2C {
    private static final Object mutex=new Object();

    public boolean read(int registerAddress, int count, byte[] buffer) {
        synchronized(mutex){
        return super.read(registerAddress, count, buffer);
        }
    }

    public synchronized boolean transaction(byte[] dataToSend, int sendSize, byte[] dataReceived, int receiveSize) {
        synchronized(mutex){
        return super.transaction(dataToSend, sendSize, dataReceived, receiveSize);
    }
    }

    public synchronized boolean write(int registerAddress, int data) {
        synchronized(mutex){
        return super.write(registerAddress, data);
        }
    }

    public I2CSync(DigitalModule module, int deviceAddress) {
        super(module, deviceAddress);
    }
    
}
